package com.yiren.backstage.currency.entity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.io.Serializable;
import java.util.List;

import org.greenrobot.greendao.annotation.JoinEntity;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.yiren.backstage.db.dao.DaoSession;
import com.yiren.backstage.db.dao.LineInfoEntityDao;
import com.yiren.backstage.db.dao.MapEntityDao;

/**
 * @author xiaozan
 * @Date : 2022/7/15 下午2:33
 * @description:高精度地图信息实体类
 */
@Entity(nameInDb = "map_entity", createInDb = false)
public class MapEntity implements Serializable {

    private static final long serialVersionUID = 6248921179537872189L;

    @Id
    private String id;

    /*** 所属考场 */
    private String siteCode;

    /*** 地图名称 */
    private String name;

    /*** 用户Id */
    private int userId;

    /*** 版本号 */
    private float mapVer;

    /*** 地图类型 */
    private int mapType;

    /*** 使用范围 1:个别用户 2：全部用户 */
    private int useRange;

    /*** 更新详情 */
    private String updateDetails;

    /*** 更新模式 */
    private int updateModel;

    /*** 发布时间 */
    private long publishTime;

    /*** 状态 */
    private int state;

    /*** 基站Id */
    private String baseId;

    /*** 线路Id */
    @ToMany(referencedJoinProperty = "mapId")
    private List<LineInfoEntity> lines;

    /*** 城市ID */
    private int districtId;

    /*** 位置信息 */
    private String address;

    /*** 基站名字 */
    private String baseName;

    /*** 是否可更新 */
    @Transient
    private boolean isUpdate;

    /*** 是否下载 */
    @Transient
    private boolean isDownLoad;

    /*** 最新的版本 */
    @Transient
    private float mapVerLast;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 356811438)
    private transient MapEntityDao myDao;

    @Generated(hash = 1517293501)
    public MapEntity(String id, String siteCode, String name, int userId,
            float mapVer, int mapType, int useRange, String updateDetails,
            int updateModel, long publishTime, int state, String baseId,
            int districtId, String address, String baseName) {
        this.id = id;
        this.siteCode = siteCode;
        this.name = name;
        this.userId = userId;
        this.mapVer = mapVer;
        this.mapType = mapType;
        this.useRange = useRange;
        this.updateDetails = updateDetails;
        this.updateModel = updateModel;
        this.publishTime = publishTime;
        this.state = state;
        this.baseId = baseId;
        this.districtId = districtId;
        this.address = address;
        this.baseName = baseName;
    }

    @Generated(hash = 717763387)
    public MapEntity() {
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getSiteCode() {
        return this.siteCode;
    }

    public void setSiteCode(String siteCode) {
        this.siteCode = siteCode;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getUserId() {
        return this.userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public float getMapVer() {
        return this.mapVer;
    }

    public void setMapVer(float mapVer) {
        this.mapVer = mapVer;
    }

    public int getMapType() {
        return this.mapType;
    }

    public void setMapType(int mapType) {
        this.mapType = mapType;
    }

    public int getUseRange() {
        return this.useRange;
    }

    public void setUseRange(int useRange) {
        this.useRange = useRange;
    }

    public String getUpdateDetails() {
        return this.updateDetails;
    }

    public void setUpdateDetails(String updateDetails) {
        this.updateDetails = updateDetails;
    }

    public int getUpdateModel() {
        return this.updateModel;
    }

    public void setUpdateModel(int updateModel) {
        this.updateModel = updateModel;
    }

    public long getPublishTime() {
        return this.publishTime;
    }

    public void setPublishTime(long publishTime) {
        this.publishTime = publishTime;
    }

    public int getState() {
        return this.state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getBaseId() {
        return this.baseId;
    }

    public void setBaseId(String baseId) {
        this.baseId = baseId;
    }

    public int getDistrictId() {
        return this.districtId;
    }

    public void setDistrictId(int districtId) {
        this.districtId = districtId;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBaseName() {
        return this.baseName;
    }

    public void setBaseName(String baseName) {
        this.baseName = baseName;
    }

    public boolean isUpdate() {
        return isUpdate;
    }

    public void setUpdate(boolean update) {
        isUpdate = update;
    }

    public boolean isDownLoad() {
        return isDownLoad;
    }

    public void setDownLoad(boolean downLoad) {
        isDownLoad = downLoad;
    }

    public float getMapVerLast() {
        return mapVerLast;
    }

    public void setMapVerLast(float mapVerLast) {
        this.mapVerLast = mapVerLast;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1308225930)
    public List<LineInfoEntity> getLines() {
        if (lines == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            LineInfoEntityDao targetDao = daoSession.getLineInfoEntityDao();
            List<LineInfoEntity> linesNew = targetDao._queryMapEntity_Lines(id);
            synchronized (this) {
                if (lines == null) {
                    lines = linesNew;
                }
            }
        }
        return lines;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1682499050)
    public synchronized void resetLines() {
        lines = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1763514408)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getMapEntityDao() : null;
    }

    
}